package it.polimi.traveldream.ejb.entities;

import java.io.Serializable;
import javax.persistence.*;


/**
 * Author: Tosatto Samuele
 * Description:
 * This Entity represent a user with password and group. The main difference between the examples 
 * viewed in the scass is that we used a relation many to many between USERS and GROUP.
 * In my point of view in this project is sufficient to have ONE to MANY relations which:
 * 
 *  one user belongs to exactly one group
 *  in one group there are N users
 *  
 * So as database theory wants a binary relations ONE to MANY can be merged in one table, as is the case.
 * USERGROUP table is specified in the Realm on glassfish as:
 * 
 * User Table = usergroup
 * Group Table = usergroup
 * 
 *So them are the same table.
 */
@Entity
@NamedQuery(name="Usergroup.findAll", query="SELECT u FROM Usergroup u")
public class Usergroup implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String email;

	private String groupname;

	private String password;

	public Usergroup() {
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getGroup() {
		return this.groupname;
	}

	public void setGroup(String group) {
		this.groupname = group;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}